package com.right.health.app.ui.me.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.magic.basic.adapter.BaseAbsAdapter;
import com.magic.basic.utils.TimeUtil;
import com.right.health.app.R;
import com.right.health.app.bean.ReviewReminderInfo;
import com.right.health.app.constants.AppConfig;

/*
 * Created by hopeliao on 2019-09-24
 *
 */
public class ReviewReminderAdapter extends BaseAbsAdapter<ReviewReminderInfo> {

    private View.OnClickListener mClickListener;

    public void setOnClickListener(View.OnClickListener listener) {
        this.mClickListener = listener;
    }

    public ReviewReminderAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.review_reminder_item, null);
            viewHolder = new ViewHolder();
            viewHolder.nameTv = (TextView) convertView.findViewById(R.id.tv_title);
            viewHolder.nextTimeTv = (TextView) convertView.findViewById(R.id.tv_next_time);
            viewHolder.tipsTv = (TextView) convertView.findViewById(R.id.tv_desc);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        ReviewReminderInfo info = mDataSource.get(position);
        viewHolder.nameTv.setText(info.visitagainname);

        String nextTime = TimeUtil.convertTime(AppConfig.FORMAT_TIME, Long.parseLong(info.nextvisittime));
        viewHolder.nextTimeTv.setText(nextTime);

        viewHolder.tipsTv.setText(info.visitdesc);
        return convertView;
    }

    private class ViewHolder {
        private ImageView contentImage;
        private TextView nameTv, nextTimeTv;
        private TextView tipsTv;
    }
}
